'    Copyright (C) <2008>  <Kevin Pletinckx>
'
'    This program is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.
'
'    This program is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.
'
'    You should have received a copy of the GNU General Public License
'    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Public Class frmLogin
    Dim objIniFile As New IniFile(My.Settings.INI_Location)
    'Loads [Settings] from the ini file.
    Dim Title As String = objIniFile.GetString("Settings", "Title", "")
    Dim Image As String = objIniFile.GetString("Settings", "Image", "")
    Dim Pass As String = objIniFile.GetString("Settings", "Password", "")

    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        'Checks for password
        If txtPassword.Text = Pass Then
            Me.Close()
            frmSettings.Show()
        Else
            MsgBox("Wrong password, please try again.", MsgBoxStyle.Exclamation, "Wrong password")
            txtPassword.Clear()
            Exit Sub
        End If
    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub

    Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Loads title
        Me.Text = Title & "Login"
        'Loads toplogo
        If Image <> "" Then
            imgTopLogo.Image = Reela.My.Resources.Resources.reela
        Else
            Exit Sub
        End If
    End Sub

End Class
